<form name="frmMock" class="form-horizontal" ng-init="dvm.init()" ng-submit="dvm.send(frmMock.$valid)" novalidate>
  <div class="modal-header">
    <button type="button" class="close" ng-click="dvm.close()">&times;</button>
    <h4 class="modal-title">测试MOCK数据</h4>
  </div>
  <div class="modal-body">
    <div class="form-group">
      <label class="col-sm-3 control-label">Mock URL：</label>
      <div class="col-sm-9">
        <input name="url" type="text" class="form-control" ng-model="dvm.url" autofocus required
            pattern="^http(s)?://[\w-\.]+(:\d+)?(/[\w-./?%&=]*)?$"
            ng-class="{'x-invalid': frmMock.$submitted && frmMock.url.$invalid}">
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.url.$error.required">Mock URL 不能为空</p>
        <p class="text-danger" ng-show="frmMock.$submitted && frmMock.url.$error.pattern">Mock URL 格式错误</p>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">Method：</label>
      <div class="col-sm-9">
        <select class="form-control" ng-model="dvm.method">
          <option value="GET" selected>GET</option>
          <option value="POST">POST</option>
        </select>
      </div>
    </div>
    <div class="form-group" ng-show="dvm.method == 'POST'">
      <label class="col-sm-3 control-label">Request Body：</label>
      <div class="col-sm-9">
        <pre id="json-request"></pre>
        <p class="text-danger" ng-show="frmMock.$submitted && !dvm.parsable">Request Body 格式错误</p>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">Response Body：</label>
      <div class="col-sm-9">
        <pre id="json-response">{{dvm.response}}</pre>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-primary" ng-disabled="frmMock.$invalid">发送</button>
    <button type="button" class="btn btn-default" ng-click="dvm.close()">关闭</button>
  </div>
</form>
